package com.anlgin.anl_tea.controller;

import com.anlgin.anl_tea.entities.Order;
import com.anlgin.anl_tea.entities.RetResponse;
import com.anlgin.anl_tea.entities.RetResult;
import com.anlgin.anl_tea.entities.Store;
import com.anlgin.anl_tea.service.IStoreService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anlgin.anl_tea.tools.CommodityTools;

import java.util.List;


/**
 * 店铺接口
 */
@RestController
@RequestMapping("/store")
@CrossOrigin
public class StoreController {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    CommodityTools tools;

    @Autowired
    private IStoreService storeService;

    /**
     * 获取所有店铺信息
     */
    @RequestMapping("/getAllStore")
    public RetResult addOrder(Order order, String commodityListJSON) {
        logger.info("获取所有店面");
        List<Store> stores = storeService.getAllStore();
        logger.info(stores.toString());
        return RetResponse.makeOKRsp(stores);
    }
}
